package javasec.contempt.actions;

import java.io.File;

import javasec.contempt.consoles.SeedLogConsole;
import javasec.contempt.data.SeedConnector;
import javasec.contempt.dialogs.KeyWindow;
import javasec.contempt.dialogs.StartSeedDialog;
import javasec.contempt.dialogs.TextWindow;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;



public class KeyManagerAction extends Action implements ISelectionListener,
		IWorkbenchAction
{
	private final IWorkbenchWindow window;
	public final static String ID="javasec.contempt.StartServerAction";
	//private IStructuredSelection selection;
	
	public KeyManagerAction(IWorkbenchWindow window)
	{
		this.window=window;
		setId(ID);
		setText("Key Manager");
		setToolTipText("santa436322");
		
		window.getSelectionService().addSelectionListener(this);
	}
	
	public void selectionChanged(IWorkbenchPart part, ISelection selection)
	{
		
	}

	public void dispose()
	{
		window.getSelectionService().removeSelectionListener(this);
	}

	public void run()
	{
		// make sure to only create one instance of the key window
		if(KeyWindow.instance==null)
		{
			KeyWindow window=new KeyWindow();
			window.open();
		}
		else
		{
			KeyWindow.instance.open();
		}
	}
}
